from time import sleep
import pytest
from playwright.sync_api import sync_playwright

@pytest.fixture(scope='function',autouse=True)
def setup_teardown():
    pd=sync_playwright().start()
    browser =pd.chromium.launch(headless=False, args=["--start-maximized"])
    p=browser.new_page()
    yield p
    sleep(5)
    browser.close()
    p.close()

def test_case_a3mall_01(setup_teardown):
    p=setup_teardown
    p.goto('https://www.jiuxian.com/')
    p.locator('text=请登录').nth(0).click()
    dy1=p.locator('text=帐号登录').nth(0).text_content()
    assert dy1=='帐号登录'
    p.locator('xpath=/html/body/div/form/div/div/div/div/div[1]/div[2]/div[1]/input').nth(0).fill('19834511018')
    p.locator('xpath=/html/body/div/form/div/div/div/div/div[1]/div[2]/div[2]/input[1]').nth(0).fill('khl131488..')
    sleep(10)
    p.locator('xpath=/html/body/div/form/div/div/div/div/div[1]/div[2]/div[4]/input').nth(0).click()
    p.locator('xpath=/html/body/div/div[4]/div[2]/div[2]/a').click()